<?php
header("Content-Type:text/html; charset=utf-8");

require_once("../../connectMysql/connetMysql.class.php");
$db=new connetMysql;
$con=$db->getConnect();

$useractivecode= $_GET["verify"];

date_default_timezone_set('prc');
$time1=date('Y-m-d H:i:s',time());
$t1 = strtotime($time1);


$result = mysqli_query($con,"SELECT * FROM user where useractivecode='".$useractivecode."'");

if($row = mysqli_fetch_array($result))
  {
  
		$t2 = strtotime($row["registertime"])+60*60*24;
		if($t1>$t2)
		  {
			echo "激活码已过期<br/><a href='http://localhost/registertest/register/register.html'>点击返回注册页面</a>"; 
		  }
		else
		  {
			mysqli_query($con,"UPDATE user SET userstate = '1' where useractivecode='".$useractivecode."'");	
			echo "账号激活成功！<br/><a href='http://localhost/registertest/register/register.html'>点击进入网站页面</a>";  
		  }
    }

mysqli_close($con);
?>
